package cate.game.event.position;

import cate.common.table.d.GDFunc;
import cate.game.event.GameEventListener;
import cate.game.role.Role;
import cate.game.role.fight.FuncPosition;

public class UpdatePositionListener implements GameEventListener<UpdatePositionEvent> {
    @Override
    public void onEvent(UpdatePositionEvent gameEvent) {
        Role role = gameEvent.role;
        FuncPosition funcPosition = gameEvent.funcPosition;
        switch (funcPosition.funcId) {
            case GDFunc.ADVENTURE:
                role.getHistory().action.spicesOnNum();
                role.getHistory().action.teamTalentLevel();
                role.getHistory().action.gemLevelNum();
                role.getHistory().action.equipQualityStarOn();
                role.getHistory().action.furnitureQualityOn();
                role.getHistory().action.teamYokeOn();
                role.getHistory().action.teamRuneOn();
                role.getHistory().action.teamHeroStar();
                break;
            case GDFunc.POINT_RACE_DEF:
                role.getGame().pvp.pointRace.getHandler().updatePosition(role, funcPosition);
                break;
            case GDFunc.ELITE_RACE:
                break;
            case GDFunc.LADDER_RACE_DEF:
                role.getPvp().ladder.updatePs(role);
                break;
            case GDFunc.CHAMPION_RACE:
                role.getGame().pvp.championRace.markDirty(role.getUid());
                break;
            case GDFunc.TEAM_PVP:
                role.getGame().pvp.teamPvp.savePosition(role);
                break;
            default:
                break;
        }
    }
}
